<div class="xl12 xm4 gg">

	<php>

		if($_SESSION['user']){
	</php>
	<empty name="_SESSION['user']['avatar']"><img src="__TMPL__Public/images/wutouxiang.jpg" class="touxiang" /></empty>
	<notempty name="_SESSION['user']['avatar']"><img src="{:sp_get_user_avatar_url($_SESSION['user']['avatar'])}" class="touxiang" /></notempty>

	<span class="name">
					  	{$_SESSION['user']['user_nicename']}
					  </span>
	<span class="cz">
					   	<a href="{:U('user/center/index')}">个人中心</a>&nbsp;&nbsp;&nbsp;
					   	<a href="{:U('user/index/logout')}">退出</a>
					   </span>
	<php>
		}else{
	</php>
	<div>
		<h3><span class="icon-user"></span> 用户登录</h3>
		<br />
		<form method="post" class="form-x form-auto" action="{:U('user/login/dologin')}">
			<div class="form-group">
				<div class="label">
					<label for="username">
						用户名</label>
				</div>
				<div class="field">
					<input type="text" class="input input-auto" id="username" name="username" size="30" data-validate="required:必填" placeholder="手机/邮箱/账号" />
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label for="detail">
						密&nbsp;&nbsp;码</label>
				</div>
				<div class="field">
					<input type="password" class="input input-auto" id="password" name="password" size="30" data-validate="required:必填" placeholder="密码" />
				</div>
			</div>
			<div class="form-group">
				<div class="label">
					<label for="detail">
						验证码</label>
				</div>
				<div class="field">
					<input type="text" class="input input-auto" id="verify" name="verify" style="width: 134px;" placeholder="请输入验证码" data-validate="required:必填"> {:sp_verifycode_img('length=4&font_size=15&width=100&height=35&charset=1234567890&use_curve=0')}
				</div>
			</div>

			<div class="form-button">
				<button class="button bg-blue" type="submit">
					登录</button>&nbsp;&nbsp;&nbsp;&nbsp;
				<a class="button bg" href="{:leuu('user/register/index')}"> 注册</a> &nbsp; &nbsp;
				<a href="{:U('api/oauth/login',array('type'=>'qq'))}"><img src="__TMPL__Public/images/qq.png" alt="QQ登录" style="width: 20px;  height: 20px; border-radius: 13px;
" /> &nbsp;</a>
				<a href="{:U('api/oauth/login',array('type'=>'sina'))}"><img src="__TMPL__Public/images/weibo.png" alt="微博登录" style="width: 20px;  height: 20px; border-radius: 13px;
" /> &nbsp;</a>
			</div>
		</form>
	</div>
	<php>
		}
	</php>

	<br />
	<hr />
	<div id="nav_top" style="width: 100%;max-width:380px;">
		<div>
			<h3><span class="icon-wrench"></span> 我的标签</h3>
			<h4>
			<php>
				$keys=_sp_sql_keywords_bypostcatid(0,',',60);
			</php>
			<div class="tag-ul">
                <volist name="keys['0']" id="v" key="k" empty="暂时没有标签">
                	
                    <if condition="$k % 6 ==5">
                        <a class="button button-little bg-main" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                    <if condition="$k % 6 ==4">
                        <a class="button button-little bg-sub" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                    <if condition="$k % 6 ==3">
                        <a class="button button-little bg-red" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                    <if condition="$k % 6 ==2">
                        <a class="button button-little bg-yellow" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                    <if condition="$k % 6 ==1">
                        <a class="button button-little bg-blue" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                    <if condition="$k % 6 ==0">
                        <a class="button button-little bg-green" href="{:leuu('portal/search/index',array('keyword'=>$key))}" title="{$v}篇文章">{$key}</a>
                    </if>
                </volist>
            </div>			
		</h4>
		</div>
	
	<hr />
	
	</div>
	<hr />
	<h2 class="bg-main1 text-white padding">随机文章</h2>
	<php>
		$tag='cid:3,4,5,6,7;order:RAND();limit:3'; $posts=sp_sql_posts($tag);

	</php>
	<div class="padding-big bg">
		<ul class="list-media list-underline">
			<foreach name="posts" item="vo">
				<php>
					$smeta=json_decode($vo['smeta'],true);
				</php>
				<li>
					<div class="media media-x img-small">
						<a class="float-left" href="{:leuu('article/index',array('id'=>$vo['tid']))}"><img src="{:sp_get_asset_upload_path($smeta['thumb'])}" class="radius"></a>
						<div class="media-body">
							<strong>{$vo.post_title}</strong>
							<span class="sj_con">
												{$vo.post_excerpt}
											</span>
							<a class="button button-little border-red swing-hover" href="{:leuu('article/index',array('id'=>$vo['tid']))}">查看详情</a>
						</div>
					</div>
				</li>
			</foreach>

		</ul>
	</div>
	<br />

	<div class="tab border-main1" data-toggle="hover" style="min-height: 470px;">
		<div class="tab-head">

			<ul class="tab-nav">
				<li class="active"><a  class="tab-start2" style="cursor: pointer;">热门文章</a> </li>
				<li><a class="tab-css2" style="cursor: pointer;">最新评论</a> </li>
				<li><a class="tab-units2" style="cursor: pointer;">最新加入</a> </li>
			</ul>
		</div>
		<div class="tab-body " style="min-height: 415px;">
			<div class="tab-panel active" id="tab-start2">
				<php>
					$hot_articles=sp_sql_posts("cid:3,4,5,6;field:term_id,post_title,post_excerpt,tid,smeta;order:post_hits desc;limit:4;");
				</php>
				<foreach name="hot_articles" item="vo">
					<php>
						$smeta=json_decode($vo['smeta'],true); $term_id=$vo['term_id']; $term=sp_get_term($term_id );

					</php>

					<div class="panel-group" style="border-top: solid 0px #ddd;">
						<div class="media media-x">
							<a class="float-left" href="{:leuu('article/index',array('id'=>$vo['tid']))}">
								<img src="{:sp_get_asset_upload_path($smeta['thumb'])}" class="radius-circle" width="60px" height="60px">
							</a>
							<div>
								<strong><span class="tag bg-yellow shake-hover button" style="border: 0;height: 21px;">{$term.name}</span>&nbsp; <a href="{:leuu('article/index',array('id'=>$vo['tid']))}" title="{$vo.post_title}">{$vo.post_title|msubstr=0,13,'utf-8',true}</a></strong>								{$vo.post_excerpt|msubstr=0,30,'utf-8',true}
							</div>
						</div>
					</div>
				</foreach>
			</div>
			<div class="tab-panel" id="tab-css2">
				<php>$last_comments=sp_get_comments("field:*;limit:0,4;order:createtime desc;");</php>
				<foreach name="last_comments" item="vo" key="k">
					<php>
						$rs=get_toux($vo['uid']); $avatar=$rs['avatar'];
					</php>
					<div class="panel-group" style="border-top: solid 0px #ddd;">
						<div class="media media-x">
							<a class="float-left" href="#">
								<if condition="empty($avatar)">
									<img src="__TMPL__/Public/images/wutouxiang.jpg" class="radius-circle" width="60px" height="60px">

									<else/>
									<img src="{:sp_get_user_avatar_url($avatar)}" class="radius-circle" width="60px" height="60px">

								</if>

							</a>
							<div class="media-body">
								<strong>
									<span class="icon-paper-plane"></span> <a href="{:U('user/index/index',array('id'=>$vo['uid']))}">{$vo.full_name}</a></strong>
								<p style="margin-bottom: 3px;">{$vo.content|msubstr=0,18,'utf-8',true}</p>
								<span class="tag bg-dot"><a href="{:leuu('article/index',array('id'=>$vo['url']))}" style="color: #fff;">查看原文</a></span>
							</div>
						</div>
					</div>

				</foreach>

				<br/>
			</div>
			<div class="tab-panel" id="tab-units2">
				<php>
					$last_users=sp_get_users("field:*;limit:0,19;order:create_time desc;");
				</php>
				<ul class="list-unstyled tc-photos margin-bottom-30">
					<foreach name="last_users" item="vo">
						<li class="zxjr">
							<a href="{:U('user/index/index',array('id'=>$vo['id']))}" title="{$vo['user_nicename']}">
	                    <img alt="{$vo['user_nicename']}" src="{:U('user/public/avatar',array('id'=>$vo['id']))}" class="radius-circle touxiang" style="width: 70px;height: 70px;">
	                    </a>
						</li>
					</foreach>

				</ul>
			</div>
		</div>
	
<br />
		<div>
			<h3><span class="icon-retweet"></span> 友情链接</h3>
			<br />
			<div class="links">
				<php>$links=sp_getlinks();</php>
				<foreach name="links" item="vo">

					<a href="{$vo.link_url}" target="{$vo.link_target}" class="button border-blue ring-hover" role="button">{$vo.link_name}</a>&nbsp;
				</foreach>

			</div>
		</div>
	</div>
	<br />
	<hr />
	<br />

</div>